const mongoose = require('mongoose')
const baseModel = require('./base-model')
const Schema = mongoose.Schema
// 用户数据模型
const articleSchema = mongoose.Schema({
  ...baseModel,
  title: {
    type: String,
    require: true
  },
  description: {
    type: String,
    require: true
  },
  body: {
    type: String,
    require: true
  },
  tagList: {
    type: [String],
    default: null
  },
  favoritesCount: {
    type: Number,
    default: 0
  },
  favorited: {
    type: Boolean,
    default: false
  },
  author: { 
    type: Schema.Types.ObjectId, 
    ref: 'User' 
  }
});

module.exports = articleSchema